<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
	var arr1 = [432,23,54,2,3,1,5,43,63];
         function selectSort2 (arr1) {
			for (var i = 0; i < arr1.length-1; i++) {
				var num=arr1[i];
				var index=i;
				for (var j = i+1; j< arr1.length; j++) {
					if (num>arr1[j]) {
						num=arr1[j];
						index=j;
					}
				}
				if (index!=i) {
					temp1(arr1,i,index)
				}
			}
			return arr1;
		}
        console.log(selectSort2(arr1));
         function temp1(arr1,i,index){
         	temp = arr1[i];
	        arr1[i] = arr1[index];
	        arr1[index] = temp;
         }
	</script>
</body>
</html>